﻿Public Class TraCuuBV
    Private bustracuubv As New BUS.TraCuuBV
    Private dtotracuubv As New DTO.TraCuuBV

    Private Sub TraCuuBV_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Me.Hide()
        e.Cancel = True
    End Sub

    Private Sub TraCuuBV_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dtgtracuubv.DataSource = bustracuubv.dtload().Tables(0)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Hide()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        dtotracuubv.hotenhk = txthotenhk.Text
        dtotracuubv.macb = txtmacb.Text
        dtotracuubv.ngaybd = dtbegin.Value
        dtotracuubv.ngaykt = dtend.Value
        Dim dg As DataSet = bustracuubv.find(dtotracuubv)
        If dg.Tables(0).Rows.Count = 0 Then
            MessageBox.Show("Không tìm thấy thông tin thỏa yêu cầu!", "Thông báo", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error)
            Exit Sub
        End If
        dtgtracuubv.DataSource = dg.Tables(0)
    End Sub

End Class